package hairmember

import (
	"github.com/flipped-aurora/gin-vue-admin/server/middleware"
	"github.com/gin-gonic/gin"
)

type MembersRouter struct{}

// InitMembersRouter 初始化 members表 路由信息
func (s *MembersRouter) InitMembersRouter(Router *gin.RouterGroup, PublicRouter *gin.RouterGroup) {

	membersRouter := Router.Group("hairmember/members").Use(middleware.OperationRecord())
	membersRouterWithoutRecord := Router.Group("hairmember/members")
	membersRouterWithoutAuth := PublicRouter.Group("hairmember/members")
	{
		membersRouter.POST("createMembers", membersApi.CreateMembers)             // 新建members表
		membersRouter.DELETE("deleteMembers", membersApi.DeleteMembers)           // 删除members表
		membersRouter.DELETE("deleteMembersByIds", membersApi.DeleteMembersByIds) // 批量删除members表
		membersRouter.PUT("updateMembers", membersApi.UpdateMembers)              // 更新members表
	}

	{
		membersRouterWithoutRecord.GET("findMembers", membersApi.FindMembers)       // 根据ID获取members表
		membersRouterWithoutRecord.GET("getMembersList", membersApi.GetMembersList) // 获取members表列表
	}
	{
		membersRouterWithoutAuth.GET("getMembersPublic", membersApi.GetMembersPublic) // members表开放接口
	}

	rechargeRouter := Router.Group("hairmember/recharge").Use(middleware.OperationRecord())
	rechargeRouterWithourRecord := Router.Group("hairmember/recharge")
	{
		rechargeRouter.POST("rechargeMember", membersApi.RechargeMember)                           // 会员充值
		rechargeRouterWithourRecord.GET("getMemberRechargeList", membersApi.GetMemberRechargeList) // 获取会员充值记录列表
	}
	consumeRouter := Router.Group("hairmember/consume")
	consumeRouterWithourRecord := Router.Group("hairmember/consume")
	{
		consumeRouter.POST("consumeMember", membersApi.ConsumeMember)                                   // 会员消费扣费
		consumeRouterWithourRecord.GET("getMemberConsumptionList", membersApi.GetMemberConsumptionList) // 获取会员消费记录列表
	}
}
